home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / cdgtst / aboutdlg.cpp next >
C/C++ Source or Header  |  1998-12-10  |  3KB  |  101 lines

  1. // AboutDlg.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "AboutDlg.h"
  6.  
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12.  
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CAboutDlg dialog
  15.  
  16.  
  17. CAboutDlg::CAboutDlg(CWnd* pParent /*=NULL*/)
  18.     : CDialog(CAboutDlg::IDD, pParent)
  19. {
  20.     //{{AFX_DATA_INIT(CAboutDlg)
  21.         // NOTE: the ClassWizard will add member initialization here
  22.     //}}AFX_DATA_INIT
  23. }
  24.  
  25.  
  26. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  27. {
  28.     CDialog::DoDataExchange(pDX);
  29.     //{{AFX_DATA_MAP(CAboutDlg)
  30.         // NOTE: the ClassWizard will add DDX and DDV calls here
  31.     //}}AFX_DATA_MAP
  32.     DDX_Control(pDX, IDC_EMAILLINK, m_EMailLink);
  33.     DDX_Control(pDX, IDC_HOMEPAGELINK, m_HomePageLink);
  34. }
  35.  
  36.  
  37. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  38.     //{{AFX_MSG_MAP(CAboutDlg)
  39.     //}}AFX_MSG_MAP
  40.     ON_WM_PAINT()
  41. END_MESSAGE_MAP()
  42.  
  43. /////////////////////////////////////////////////////////////////////////////
  44. // CAboutDlg message handlers
  45.  
  46. BOOL CAboutDlg::OnInitDialog() 
  47. {
  48.     CDialog::OnInitDialog();
  49.     
  50.     // Set HyperLink for E-Mail
  51.     m_EMailLink.SetURL(_T(IDS_MAILADDR));
  52.     m_EMailLink.SetUnderline(TRUE);
  53.     m_EMailLink.SetLinkCursor(AfxGetApp()->LoadCursor(IDC_HAND));
  54.  
  55.     // Set HyperLink for Home Page
  56.     m_HomePageLink.SetURL(_T(IDS_HOMEPAGEADDR));
  57.     m_HomePageLink.SetUnderline(TRUE);
  58.     m_HomePageLink.SetLinkCursor(AfxGetApp()->LoadCursor(IDC_HAND));
  59.         
  60.     SetLogoFont("Verdana", -25);
  61.  
  62.     // Write class version
  63.     CString sVersion;
  64.     sVersion.Format("CDigitST v%s", CDigitST::GetVersionC());
  65.     GetDlgItem(IDC_VERSION)->SetWindowText(sVersion);
  66.  
  67.     // Fill friends listbox
  68.     m_lbxFriends.SubclassDlgItem(IDC_FRIENDS, this);
  69.  
  70.     return TRUE;
  71. }
  72.  
  73.  
  74. void CAboutDlg::SetLogoFont(CString Name, int nHeight, int nWeight, BYTE bItalic, BYTE bUnderline)
  75. {
  76.   if(m_fontLogo.m_hObject) m_fontLogo.Detach();
  77.  
  78.   m_fontLogo.CreateFont(nHeight, 0, 0, 0, nWeight, bItalic, bUnderline,0,0,0,0,0,0, Name);
  79. } // End of SetLogoFont
  80.  
  81.  
  82. void CAboutDlg::OnPaint()
  83. {
  84.     CPaintDC dc(this); // device context for painting
  85.  
  86.     CRect rectDlg;
  87.     GetWindowRect(rectDlg);
  88.     ScreenToClient(rectDlg);
  89.  
  90.     CFont* OldFont = dc.SelectObject(&m_fontLogo);
  91.  
  92.     CSize sizeText = dc.GetTextExtent(STSIGN, strlen(STSIGN));
  93.  
  94.     dc.DrawState(CPoint((rectDlg.Width()-sizeText.cx)/2, 10), 
  95.                  rectDlg.Size(), 
  96.                  STSIGN, 
  97.                  DSS_DISABLED, TRUE, 0, (CBrush*)NULL);
  98.  
  99.     dc.SelectObject(OldFont);
  100. } // End of OnPaint
  101.